package com.topone.dataObject;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.topone.Enum.ConvenientInfoEnum;
import com.topone.Utils.EnumUnitl;
import lombok.Data;
import org.hibernate.annotations.DynamicUpdate;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.Entity;
import javax.persistence.EntityListeners;
import javax.persistence.Id;
import java.util.Date;

/**
 * Created by Administrator on 2017/12/31,0031.
 */
@Entity
@DynamicUpdate
@Data
@EntityListeners(AuditingEntityListener.class)
public class ConvenientInfo {
    @Id
    private String convenientId;    //id

    private String convenientType;  //信息类型

    private String convenientDescription;  //信息描述

    private String convenientIcon;  //信息图片

    private Integer convenientStatus= ConvenientInfoEnum.CHECK.getCode();  //默认生效，

    private String title;

    private String phone;

    private String creator;  //申请者

    private String updator;  //更新者

    @CreatedDate
    private Date createTime;  //创建时间

    @LastModifiedDate
    private Date updateTime;  //更新时间

    @JsonIgnore
    public ConvenientInfoEnum getConvenientInfoEnum(){

        return EnumUnitl.getByCode(convenientStatus,ConvenientInfoEnum.class);
    }

}
